﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
namespace Web.Shared
{
    public partial class register : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
        {
            Model.Sys.UserInfo ui = new Model.Sys.UserInfo();
            try
            {
                Roles.AddUserToRole(CreateUserWizard1.UserName, "Users"); 
                int flag = ui.InitUser(CreateUserWizard1.UserName, CreateUserWizard1.Email);
                if (flag < 0)
                {
                    Response.Write("<script>alert('注册未能成功，请稍候再试 ')</script>");
                }
            }
            catch (Exception ex)
            {
               WebHelper.Pages.Log.WriteLog(string.Format("错误：{0};用户名：{1}", ex.Message, CreateUserWizard1.UserName), "Register");
            }
        }
    }
}
